home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / kerberos / pc / krb_libd.lha / Lib / Des / DBG_PRT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-03  |  3.0 KB  |  86 lines

  1. /*
  2.  * $Source: /mit/kerberos/src/lib/des/RCS/dbg_prt.c,v $
  3.  * $Author: jtkohl $
  4.  *
  5.  * Copyright 1988 by the Massachusetts Institute of Technology.
  6.  *
  7.  * For copying and distribution information, please see the file
  8.  * <mit-copyright.h>.
  9.  *
  10.  * Debugging print routines for DES library.
  11.  *
  12.  * Under U.S. law, this software may not be exported outside the US
  13.  * without license from the U.S. Commerce department.
  14.  *
  15.  */
  16.  
  17. #ifndef    lint
  18. static char rcsid_module_c[] =
  19. "$Header: dbg_prt.c,v 4.1 89/01/24 14:08:09 jtkohl Exp $";
  20. #endif    lint
  21.  
  22. #include <mit_copy.h>
  23.  
  24. #include <stdio.h>
  25. #include "des_intn.h"
  26.  
  27. #ifdef PC8086
  28. /* The cc86 I/O library is busted.... */
  29. static char const * const hex[256] = {
  30.     "00", "01", "02", "03", "04", "05", "06", "07",
  31.     "08", "09", "0a", "0b", "0c", "0d", "0e", "0f",
  32.     "10", "11", "12", "13", "14", "15", "16", "17",
  33.     "18", "19", "1a", "1b", "1c", "1d", "1e", "1f",
  34.     "20", "21", "22", "23", "24", "25", "26", "27",
  35.     "28", "29", "2a", "2b", "2c", "2d", "2e", "2f",
  36.     "30", "31", "32", "33", "34", "35", "36", "37",
  37.     "38", "39", "3a", "3b", "3c", "3d", "3e", "3f",
  38.     "40", "41", "42", "43", "44", "45", "46", "47",
  39.     "48", "49", "4a", "4b", "4c", "4d", "4e", "4f",
  40.     "50", "51", "52", "53", "54", "55", "56", "57",
  41.     "58", "59", "5a", "5b", "5c", "5d", "5e", "5f",
  42.     "60", "61", "62", "63", "64", "65", "66", "67",
  43.     "68", "69", "6a", "6b", "6c", "6d", "6e", "6f",
  44.     "70", "71", "72", "73", "74", "75", "76", "77",
  45.     "78", "79", "7a", "7b", "7c", "7d", "7e", "7f",
  46.     "80", "81", "82", "83", "84", "85", "86", "87",
  47.     "88", "89", "8a", "8b", "8c", "8d", "8e", "8f",
  48.     "90", "91", "92", "93", "94", "95", "96", "97",
  49.     "98", "99", "9a", "9b", "9c", "9d", "9e", "9f",
  50.     "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
  51.     "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af",
  52.     "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7",
  53.     "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf",
  54.     "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7",
  55.     "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf",
  56.     "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
  57.     "d8", "d9", "da", "db", "dc", "dd", "de", "df",
  58.     "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7",
  59.     "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef",
  60.     "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
  61.     "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"
  62. };
  63. #endif /* PC8086 */
  64.  
  65. void des_debug_print(string,i,ll,lh,rl,rh)
  66.     char *string;
  67.     unsigned i;
  68.     unsigned ll,lh,rl,rh;
  69. {
  70.     printf("iter = %2d    ",i);
  71.     printf(string);
  72. #ifdef PC8086
  73.     printf("\t\tL1 = %s %s %s %s  R1 = %s %s %s %s\n",
  74.        hex[ll & 0xff], hex[(ll >> 8) & 0xff],
  75.        hex[lh & 0xff], hex[(lh >> 8) & 0xff],
  76.        hex[rl & 0xff], hex[(rl >> 8) & 0xff],
  77.        hex[rh & 0xff], hex[(rh >> 8) & 0xff]);
  78. #else /* ! PC8086 */
  79.     printf("\t\tL1 = %02x %02x %02x %02x  R1 = %02x %02x %02x %02x\n",
  80.        ll & 0xff, (ll >> 8) & 0xff,
  81.        lh & 0xff, (lh >> 8) & 0xff,
  82.        rl & 0xff, (rl >> 8) & 0xff,
  83.        rh & 0xff, (rh >> 8) & 0xff);
  84. #endif
  85. }
  86.